<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>时间助手</title>
  <!-- <style>
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body { width: 100vw; height: 100vh; max-width:576px;margin: 0 auto; overflow-x: hidden; }
    #app { margin: 0 auto; height: 100%; background-color: #000; }
    #contentText { width: 100%; padding: 10%; color: #ccc; position: relative; z-index: 99; }

    * {margin:0;padding:0;box-sizing:border-box;}
    body {overflow-x:hidden;width:100vw;height:100vh;}
    .center-train {margin:0 auto;height:100%;overflow:hidden;position:relative;top:-100%;user-select: none;}
    .mountains {
      height:100%;position:absolute;width:100%;z-index:1;
      background-repeat:no-repeat;background-position:left top;background-size:cover;
      /* background-image:url('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fitem%2F202003%2F16%2F20200316100230_jplju.thumb.1000_0.jpeg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1652317417&t=3aa586094b0bc78f4d1c4974ec1657b5'); */
      background-image: url(''); }
    .mountains::before,.mountains::after {background:#000c18;background:-moz-linear-gradient(#012a53,#000c18 50%);background:-webkit-linear-gradient(#012a53,#000c18 50%);background:-o-linear-gradient(#012a53,#000c18 50%);background:-ms-linear-gradient(#012a53,#000c18 50%);background:linear-gradient(#012a53,#000c18 50%);content:"";height:100%;position:absolute;display:none;}
    .mountains::before {border-radius:100% 300% 0 0;left:-20%;width:57%;}
    .mountains::after {border-radius:300% 100% 0 0;right:-20%;width:80%;}
    .bridge {border-bottom:0.3rem solid white;border-top:0.3rem solid white;background:black;background:-webkit-linear-gradient(55deg,transparent 46%,white 46%,white 54%,transparent 54%) left/1.6rem 2.2rem,-webkit-linear-gradient(-55deg,transparent 46%,white 46%,white 54%,transparent 54%) left/1.6rem 2.2rem;background:-moz-linear-gradient(55deg,transparent 46%,white 46%,white 54%,transparent 54%) left/1.6rem 2.2rem,-moz-linear-gradient(-55deg,transparent 46%,white 46%,white 54%,transparent 54%) left/1.6rem 2.2rem;background:-o-linear-gradient(55deg,transparent 46%,white 46%,white 54%,transparent 54%) left/1.6rem 2.2rem,-o-linear-gradient(-55deg,transparent 46%,white 46%,white 54%,transparent 54%) left/1.6rem 2.2rem;background:-ms-linear-gradient(55deg,transparent 46%,white 46%,white 54%,transparent 54%) left/1.6rem 2.2rem,-ms-linear-gradient(-55deg,transparent 46%,white 46%,white 54%,transparent 54%) left/1.6rem 2.2rem;background:linear-gradient(55deg,transparent 46%,white 46%,white 54%,transparent 54%) left/1.6rem 2.2rem,linear-gradient(-55deg,transparent 46%,white 46%,white 54%,transparent 54%) left/1.6rem 2.2rem;bottom:2rem;height:2.6rem;position:absolute;width:100%;z-index:1;}
    .train {animation:move-train 24s linear infinite;bottom:4.6rem;height:10rem;position:absolute;left:calc(100% + 1.3rem);width:44rem;z-index:1;}
    .engine-front,.engine-front::before,.engine-front::after {background:#0f0f0f;background:linear-gradient(0deg,#0f0f0f,#262626,#0f0f0f);border:0.1rem solid rgba(255,255,255,0.15);border-radius:50% 0 0 50%;border-right:none;}
    .engine-front {animation:body-upDown 0.3s infinite;border-radius:0.5rem 0 0 0.5rem;bottom:1.4rem;height:4.6rem;left:0;position:absolute;width:8rem;}
    .engine-front::before,.engine-front::after {content:"";position:absolute;height:70%;left:-0.9rem;top:50%;transform:translate(0,-50%);width:0.8rem;}
    .engine-front::after {height:40%;left:-1.4rem;width:0.5rem;}
    .chimney {background:#990000;height:2.2rem;left:2.5rem;position:absolute;top:-2.3rem;width:1.7rem;}
    .chimney::before,.chimney::after {content:"";position:absolute;}
    .chimney::before {animation:up-down 0.3s infinite;border-bottom:none;border-left:0.5rem solid transparent;border-right:0.5rem solid transparent;border-top:0.8rem solid orange;left:50%;top:-0.9rem;transform:translate(-50%,0);width:160%;}
    .smoke {animation:move-smoke 0.4s linear infinite;background:rgba(255,255,255,0.8);border-radius:50%;height:1.4rem;left:0.2rem;position:absolute;top:-1.5rem;width:0.8rem;z-index:-1;}
    .smoke-2 {animation-delay:0.1s;left:0.4rem;}
    .smoke-3 {animation-delay:0.2s;left:0.6rem;}
    .smoke-4 {left:0.8rem;}
    .engine-body {animation:body-upDown 0.3s 0.1s infinite;background:#b30000;background:linear-gradient(0deg,#330000,red,#990000);border-radius:0 0 0.4rem 0;bottom:1.4rem;height:7rem;left:8rem;position:absolute;width:5rem;}
    .engine-body::before,.engine-body::after {content:"";left:50%;position:absolute;transform:translate(-50%,0);}
    .engine-body::before {animation:up-down 0.3s 0.2s infinite;background:#660000;background:linear-gradient(0deg,#660000,#990000,#660000);border-radius:50% 50% 0 0;height:1.2rem;top:-1.2rem;width:130%;}
    .engine-body::after {background:#b3e0f2;border-radius:0.2rem;height:40%;top:1rem;width:45%;}
    .wheel::before,.wheel::after {left:50%;top:50%;transform:translate(-50%,-50%);}
    .wheel-holder {height:2.8rem;bottom:0;position:absolute;width:100%;}
    .wheel {animation:rotate 2s linear infinite;background:orange;border:0.3rem solid rgba(0,0,0,0.6);border-radius:50%;height:2.8rem;left:1rem;position:absolute;width:2.8rem;}
    .wheel-2 {left:4.5rem;}
    .wheel-3 {border-width:0.5rem;height:3.8rem;left:8.7rem;top:-1.1rem;width:3.8rem;}
    .wheel-4 {left:15.7rem;}
    .wheel-5 {left:19.5rem;}
    .wheel-6 {left:25.7rem;}
    .wheel-7 {left:29.5rem;}
    .wheel-8 {left:35.7rem;}
    .wheel-9 {left:39.5rem;}
    .wheel::before,.wheel::after {content:"";position:absolute;}
    .wheel::before {background:rgba(0,0,0,0.3);height:86%;width:0.2rem;}
    .wheel::after {background:#996300;background:-webkit-radial-gradient(circle at center,#b37400 30%,#996300 30%);background:-moz-radial-gradient(circle at center,#b37400 30%,#996300 30%);background:-o-radial-gradient(circle at center,#b37400 30%,#996300 30%);background:-ms-radial-gradient(circle at center,#b37400 30%,#996300 30%);background:radial-gradient(circle at center,#b37400 30%,#996300 30%);border-radius:50%;height:40%;width:40%;}
    .compartment {animation:body-upDown 0.3s infinite;background:#186c8e;background:-webkit-linear-gradient(#104b63 50%,#1f8dba);background:-moz-linear-gradient(#104b63 50%,#1f8dba);background:-o-linear-gradient(#104b63 50%,#1f8dba);background:-ms-linear-gradient(#104b63 50%,#1f8dba);background:linear-gradient(#104b63 50%,#1f8dba);border-radius:0 0 0.3rem 0.3rem;bottom:1.4rem;height:5rem;left:15rem;position:absolute;width:8rem;}
    .compartment-two {animation:body-upDown 0.3s 0.1s infinite;left:25rem;}
    .compartment-two .compartment-window::before {animation:up-down 0.3s 0.3s infinite;}
    .compartment-three {animation:body-upDown 0.3s 0.2s infinite;left:35rem;}
    .compartment-three .compartment-window::before {animation:up-down 0.35s infinite;}
    .compartment::before,.compartment::after {background:black;border:0.4rem solid transparent;bottom:0.4rem;box-shadow:0 0 0 1px rgba(255,255,255,0.1);content:"";height:0.8rem;position:absolute;width:0.9rem;}
    .compartment::before {border-left:0.4rem solid rgba(255,255,255,0.3);left:-0.9rem;}
    .compartment::after {border-right:0.4rem solid rgba(255,255,255,0.3);left:-2rem;}
    .compartment-window {background:#1f8dba;background:-moz-linear-gradient(90deg,transparent 0.8rem,skyblue 0.8rem) left/2.4rem 100%;background:-webkit-linear-gradient(90deg,transparent 0.8rem,skyblue 0.8rem) left/2.4rem 100%;background:-o-linear-gradient(90deg,transparent 0.8rem,skyblue 0.8rem) left/2.4rem 100%;background:-ms-linear-gradient(90deg,transparent 0.8rem,skyblue 0.8rem) left/2.4rem 100%;background:linear-gradient(90deg,transparent 0.8rem,skyblue 0.8rem) left/2.4rem 100%;height:40%;position:absolute;top:0.7rem;width:100%;}
    .compartment-window::before,.compartment-window::after {content:"";position:absolute;}
    .compartment-window::before {animation:up-down 0.3s 0.1s infinite;background:#104b63;border-radius:50% 50% 0 0;height:0.6rem;left:50%;top:-1.4rem;transform:translate(-50%,0);width:110%;}
    @keyframes up-down {0%,100% {transform:translate(-50%,0);}
    50% {transform:translate(-50%,-0.3rem);}
    }
    @keyframes rotate {100% {transform:rotate(-360deg);}
    }
    @keyframes move-train {100% {transform:translateX(-154rem);}
    }
    @keyframes body-upDown {0%,100% {transform:translateY(0);}
    100% {transform:translateY(-0.2rem);}
    }
    @keyframes move-smoke {0% {-webkit-filter:blur(0);-moz-filter:blur(0);-o-filter:blur(0);-ms-filter:blur(0);filter:blur(0);opacity:1;}
    50% {-webkit-filter:blur(0.2rem);-moz-filter:blur(0.2rem);-o-filter:blur(0.2rem);-ms-filter:blur(0.2rem);filter:blur(0.2rem);opacity:0.6;transform:translate(0,-3rem) scale(2);}
    100% {-webkit-filter:blur(0.3rem);-moz-filter:blur(0.3rem);-o-filter:blur(0.3rem);-ms-filter:blur(0.3rem);filter:blur(0.3rem);opacity:0;transform:translate(2.5rem,-6rem) scale(3);}
    }
    @keyframes wheel-joint {100% {transform:rotate(360deg);}
    }
  </style> -->
</head>

<body>
  <div id="app">
    <div id="contentText">
      <div class="tant1"></div>
      <div class="tant2"></div>
      <div class="tant3"></div>
    </div>
  </div>


  <div class="center-train">
    <div class="mountains"></div>
    <div class="train">
      <div class="engine-front">
        <div class="chimney">
          <div class="smoke"></div>
          <div class="smoke smoke-2"></div>
          <div class="smoke smoke-3"></div>
          <div class="smoke smoke-4"></div>
        </div>
      </div>

      <div class="engine-body"></div>

      <div class="compartment">
        <div class="compartment-window"></div>
      </div>

      <div class="compartment compartment-two">
        <div class="compartment-window"></div>
      </div>

      <div class="compartment compartment-three">
        <div class="compartment-window"></div>
      </div>

      <div class="wheel-holder">
        <div class="wheel"></div>
        <div class="wheel wheel-2">
          <div class="wheel-joint"></div>
          <div class="wheel-joint wheel-joint-2"></div>
        </div>
        <div class="wheel wheel-3"></div>
        <div class="wheel wheel-4"></div>
        <div class="wheel wheel-5"></div>
        <div class="wheel wheel-6"></div>
        <div class="wheel wheel-7"></div>
        <div class="wheel wheel-8"></div>
        <div class="wheel wheel-9"></div>
      </div>
    </div>
    <div class="bridge"></div>
  </div>

  <script>
    (function () {
      /**用法
       * TransitionLunar.toSolar(2022, 5, 5); 农历转化公历
       * TransitionLunar.toLunar(2022, 6, 3); 公历转化农历
       */
      let TransitionLunar = {
        MIN_YEAR: 1891,
        MAX_YEAR: 2100,
        lunarInfo: [
          [0, 2, 9, 21936],
          [6, 1, 30, 9656],
          [0, 2, 17, 9584],
          [0, 2, 6, 21168],
          [5, 1, 26, 43344],
          [0, 2, 13, 59728],
          [0, 2, 2, 27296],
          [3, 1, 22, 44368],
          [0, 2, 10, 43856],
          [8, 1, 30, 19304],
          [0, 2, 19, 19168],
          [0, 2, 8, 42352],
          [5, 1, 29, 21096],
          [0, 2, 16, 53856],
          [0, 2, 4, 55632],
          [4, 1, 25, 27304],
          [0, 2, 13, 22176],
          [0, 2, 2, 39632],
          [2, 1, 22, 19176],
          [0, 2, 10, 19168],
          [6, 1, 30, 42200],
          [0, 2, 18, 42192],
          [0, 2, 6, 53840],
          [5, 1, 26, 54568],
          [0, 2, 14, 46400],
          [0, 2, 3, 54944],
          [2, 1, 23, 38608],
          [0, 2, 11, 38320],
          [7, 2, 1, 18872],
          [0, 2, 20, 18800],
          [0, 2, 8, 42160],
          [5, 1, 28, 45656],
          [0, 2, 16, 27216],
          [0, 2, 5, 27968],
          [4, 1, 24, 44456],
          [0, 2, 13, 11104],
          [0, 2, 2, 38256],
          [2, 1, 23, 18808],
          [0, 2, 10, 18800],
          [6, 1, 30, 25776],
          [0, 2, 17, 54432],
          [0, 2, 6, 59984],
          [5, 1, 26, 27976],
          [0, 2, 14, 23248],
          [0, 2, 4, 11104],
          [3, 1, 24, 37744],
          [0, 2, 11, 37600],
          [7, 1, 31, 51560],
          [0, 2, 19, 51536],
          [0, 2, 8, 54432],
          [6, 1, 27, 55888],
          [0, 2, 15, 46416],
          [0, 2, 5, 22176],
          [4, 1, 25, 43736],
          [0, 2, 13, 9680],
          [0, 2, 2, 37584],
          [2, 1, 22, 51544],
          [0, 2, 10, 43344],
          [7, 1, 29, 46248],
          [0, 2, 17, 27808],
          [0, 2, 6, 46416],
          [5, 1, 27, 21928],
          [0, 2, 14, 19872],
          [0, 2, 3, 42416],
          [3, 1, 24, 21176],
          [0, 2, 12, 21168],
          [8, 1, 31, 43344],
          [0, 2, 18, 59728],
          [0, 2, 8, 27296],
          [6, 1, 28, 44368],
          [0, 2, 15, 43856],
          [0, 2, 5, 19296],
          [4, 1, 25, 42352],
          [0, 2, 13, 42352],
          [0, 2, 2, 21088],
          [3, 1, 21, 59696],
          [0, 2, 9, 55632],
          [7, 1, 30, 23208],
          [0, 2, 17, 22176],
          [0, 2, 6, 38608],
          [5, 1, 27, 19176],
          [0, 2, 15, 19152],
          [0, 2, 3, 42192],
          [4, 1, 23, 53864],
          [0, 2, 11, 53840],
          [8, 1, 31, 54568],
          [0, 2, 18, 46400],
          [0, 2, 7, 46752],
          [6, 1, 28, 38608],
          [0, 2, 16, 38320],
          [0, 2, 5, 18864],
          [4, 1, 25, 42168],
          [0, 2, 13, 42160],
          [10, 2, 2, 45656],
          [0, 2, 20, 27216],
          [0, 2, 9, 27968],
          [6, 1, 29, 44448],
          [0, 2, 17, 43872],
          [0, 2, 6, 38256],
          [5, 1, 27, 18808],
          [0, 2, 15, 18800],
          [0, 2, 4, 25776],
          [3, 1, 23, 27216],
          [0, 2, 10, 59984],
          [8, 1, 31, 27432],
          [0, 2, 19, 23232],
          [0, 2, 7, 43872],
          [5, 1, 28, 37736],
          [0, 2, 16, 37600],
          [0, 2, 5, 51552],
          [4, 1, 24, 54440],
          [0, 2, 12, 54432],
          [0, 2, 1, 55888],
          [2, 1, 22, 23208],
          [0, 2, 9, 22176],
          [7, 1, 29, 43736],
          [0, 2, 18, 9680],
          [0, 2, 7, 37584],
          [5, 1, 26, 51544],
          [0, 2, 14, 43344],
          [0, 2, 3, 46240],
          [4, 1, 23, 46416],
          [0, 2, 10, 44368],
          [9, 1, 31, 21928],
          [0, 2, 19, 19360],
          [0, 2, 8, 42416],
          [6, 1, 28, 21176],
          [0, 2, 16, 21168],
          [0, 2, 5, 43312],
          [4, 1, 25, 29864],
          [0, 2, 12, 27296],
          [0, 2, 1, 44368],
          [2, 1, 22, 19880],
          [0, 2, 10, 19296],
          [6, 1, 29, 42352],
          [0, 2, 17, 42208],
          [0, 2, 6, 53856],
          [5, 1, 26, 59696],
          [0, 2, 13, 54576],
          [0, 2, 3, 23200],
          [3, 1, 23, 27472],
          [0, 2, 11, 38608],
          [11, 1, 31, 19176],
          [0, 2, 19, 19152],
          [0, 2, 8, 42192],
          [6, 1, 28, 53848],
          [0, 2, 15, 53840],
          [0, 2, 4, 54560],
          [5, 1, 24, 55968],
          [0, 2, 12, 46496],
          [0, 2, 1, 22224],
          [2, 1, 22, 19160],
          [0, 2, 10, 18864],
          [7, 1, 30, 42168],
          [0, 2, 17, 42160],
          [0, 2, 6, 43600],
          [5, 1, 26, 46376],
          [0, 2, 14, 27936],
          [0, 2, 2, 44448],
          [3, 1, 23, 21936],
          [0, 2, 11, 37744],
          [8, 2, 1, 18808],
          [0, 2, 19, 18800],
          [0, 2, 8, 25776],
          [6, 1, 28, 27216],
          [0, 2, 15, 59984],
          [0, 2, 4, 27424],
          [4, 1, 24, 43872],
          [0, 2, 12, 43744],
          [0, 2, 2, 37600],
          [3, 1, 21, 51568],
          [0, 2, 9, 51552],
          [7, 1, 29, 54440],
          [0, 2, 17, 54432],
          [0, 2, 5, 55888],
          [5, 1, 26, 23208],
          [0, 2, 14, 22176],
          [0, 2, 3, 42704],
          [4, 1, 23, 21224],
          [0, 2, 11, 21200],
          [8, 1, 31, 43352],
          [0, 2, 19, 43344],
          [0, 2, 7, 46240],
          [6, 1, 27, 46416],
          [0, 2, 15, 44368],
          [0, 2, 5, 21920],
          [4, 1, 24, 42448],
          [0, 2, 12, 42416],
          [0, 2, 2, 21168],
          [3, 1, 22, 43320],
          [0, 2, 9, 26928],
          [7, 1, 29, 29336],
          [0, 2, 17, 27296],
          [0, 2, 6, 44368],
          [5, 1, 26, 19880],
          [0, 2, 14, 19296],
          [0, 2, 3, 42352],
          [4, 1, 24, 21104],
          [0, 2, 10, 53856],
          [8, 1, 30, 59696],
          [0, 2, 18, 54560],
          [0, 2, 7, 55968],
          [6, 1, 27, 27472],
          [0, 2, 15, 22224],
          [0, 2, 5, 19168],
          [4, 1, 25, 42216],
          [0, 2, 12, 42192],
          [0, 2, 1, 53584],
          [2, 1, 21, 55592],
          [0, 2, 9, 54560]
        ],
        //是否闰年
        isLeapYear: function (year) {
          return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0));
        },
        //天干地支年
        lunarYear: function (year) {
          let gan = ['庚', '辛', '壬', '癸', '甲', '乙', '丙', '丁', '戊', '己'],
            zhi = ['申', '酉', '戌', '亥', '子', '丑', '寅', '卯', '辰', '巳', '午', '未'],
            str = year.toString().split("");
          return gan[str[3]] + zhi[year % 12];
        },
        //生肖年
        zodiacYear: function (year) {
          let zodiac = ['猴', '鸡', '狗', '猪', '鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊'];
          return zodiac[year % 12];
        },
        //公历月份天数
        //@param year 阳历-年
        //@param month 阳历-月
        solarMonthDays: function (year, month) {
          let FebDays = this.isLeapYear(year) ? 29 : 28;
          let monthHash = ['', 31, FebDays, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
          return monthHash[month];
        },
        //农历月份天数
        lunarMonthDays: function (year, month) {
          let monthData = this.lunarMonths(year);
          return monthData[month - 1];
        },
        //农历月份天数数组
        lunarMonths: function (year) {
          let yearData = this.lunarInfo[year - this.MIN_YEAR];
          let leapMonth = yearData[0];
          let bit = (+yearData[3]).toString(2);
          let months = [];
          for (let i = 0; i < bit.length; i++) {
            months[i] = bit.substr(i, 1);
          };

          for (let k = 0, len = 16 - months.length; k < len; k++) {
            months.unshift('0');
          };

          months = months.slice(0, (leapMonth == 0 ? 12 : 13));
          for (let i = 0; i < months.length; i++) {
            months[i] = +months[i] + 29;
          };
          return months;
        },
        //农历每年的天数
        //@param year 农历年份
        lunarYearDays: function (year) {
          let monthArray = this.lunarYearMonths(year);
          let len = monthArray.length;
          return (monthArray[len - 1] == 0 ? monthArray[len - 2] : monthArray[len - 1]);
        },
        //
        lunarYearMonths: function (year) {
          let monthData = this.lunarMonths(year);
          let res = [];
          let temp = 0;
          let yearData = this.lunarInfo[year - this.MIN_YEAR];
          let len = (yearData[0] == 0 ? 12 : 13);
          for (let i = 0; i < len; i++) {
            temp = 0;
            for (let j = 0; j <= i; j++) {
              temp += monthData[j];
            }
            res.push(temp);
          };
          return res;
        },
        //获取闰月
        //@param year 农历年份
        leapMonth: function (year) {
          let yearData = this.lunarInfo[year - this.MIN_YEAR];
          return yearData[0];
        },
        //计算农历日期与正月初一相隔的天数
        betweenLunarDays: function (year, month, day) {
          let yearMonth = this.lunarMonths(year);
          let res = 0;
          for (let i = 1; i < month; i++) {
            res += yearMonth[i - 1];
          };
          res += day - 1;
          return res;
        },
        //计算2个阳历日期之间的天数
        //@param year 阳历年
        //@param month
        //@param day
        //@param l_month 阴历正月对应的阳历月份
        //@param l_day   阴历初一对应的阳历天
        betweenSolarDays: function (year, month, day, l_month, l_day) {
          let time1 = new Date(year + "-" + month + "-" + day).getTime(),
            time2 = new Date(year + "-" + l_month + "-" + l_day).getTime();
          return Math.ceil((time1 - time2) / 24 / 3600 / 1000);
        },
        //根据距离正月初一的天数计算阴历日期
        //@param year 阳历年
        //@param between 天数
        lunarByBetween: function (year, between) {
          let lunarArray = [],
            yearMonth = [],
            t = 0,
            e = 0,
            leapMonth = 0,
            m = '';
          if (between == 0) {
            t = 1;
            e = 1;
            m = '正月';
          } else {
            year = between > 0 ? year : (year - 1);
            yearMonth = this.lunarYearMonths(year);
            leapMonth = this.leapMonth(year);
            between = between > 0 ? between : (this.lunarYearDays(year) + between);
            for (let i = 0; i < 13; i++) {
              if (between == yearMonth[i]) {
                t = i + 2;
                e = 1;
                break;
              } else if (between < yearMonth[i]) {
                t = i + 1;
                e = between - ((yearMonth[i - 1]) ? yearMonth[i - 1] : 0) + 1;
                break;
              }
            };

            m = (leapMonth != 0 && t == leapMonth + 1) ?
              ('闰'.this.chineseMonth(t - 1)) :
              this.chineseMonth(((leapMonth != 0 && leapMonth + 1 < t) ? (t - 1) : t));
          }
          lunarArray.push(year, t, e); //年 月 日
          lunarArray.push(this.lunarYear(year),
            this.zodiacYear(year),
            m,
            this.chineseNumber(e)); //天干地支年 生肖年 月份 日
          lunarArray.push(leapMonth); //闰几月
          return lunarArray;
        },
        //中文月份
        chineseMonth: function (month) {
          let monthHash = ['', '正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '冬月', '腊月'];
          return monthHash[month];
        },
        //中文日期
        chineseNumber: function (num) {
          let dateHash = ['', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十'];
          let res;
          if (num <= 10) {
            res = '初' + dateHash[num];
          } else if (num > 10 && num < 20) {
            res = '十' + dateHash[num - 10];
          } else if (num == 20) {
            res = "二十";
          } else if (num > 20 && num < 30) {
            res = "廿" + dateHash[num - 20];
          } else if (num == 30) {
            res = "三十";
          }
          return res;
        },
        //转换农历
        toLunar: function (year, month, day) {
          let yearData = this.lunarInfo[year - this.MIN_YEAR];
          if (year == this.MIN_YEAR && month <= 2 && day <= 9) {
            return [1891, 1, 1, '辛卯', '兔', '正月', '初一'];
          }
          return this.lunarByBetween(year, this.betweenSolarDays(year, month, day, yearData[1], yearData[2]));
        },
        //转换公历
        //@param year  阴历-年
        //@param month 阴历-月，闰月处理：例如如果当年闰五月，那么第二个五月就传六月，相当于阴历有13个月
        //@param date  阴历-日
        toSolar: function (year, month, day) {
          let yearData = this.lunarInfo[year - this.MIN_YEAR];
          let between = this.betweenLunarDays(year, month, day);
          let ms = new Date(year + "-" + yearData[1] + "-" + yearData[2]).getTime();
          let s = ms + between * 24 * 60 * 60 * 1000;
          let d = new Date();
          d.setTime(s);
          year = d.getFullYear();
          month = d.getMonth() + 1;
          day = d.getDate();
          return [year, month, day];
        }
      };

      // console.log(TransitionLunar.toSolar(2022, 5, 5))


      /* 时间日期格式化 */
      function formatDate_timestamp(date, fmt) {
        if (/(y+)/.test(fmt)) {
          fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
        }
        let o = {
          'M+': date.getMonth() + 1,
          'd+': date.getDate(),
          'H+': date.getHours(),
          'm+': date.getMinutes(),
          's+': date.getSeconds()
        }
        for (let k in o) {
          if (new RegExp(`(${k})`).test(fmt)) {
            let str = o[k] + ''
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str))
          }
        };
        return fmt;
      };
      // 补零
      function padLeftZero(str) {
        return ('00' + str).substr(str.length)
      };

      const hzWeek = ["日", "一", "二", "三", "四", "五", "六"];
      // 辅助返回 时间段
      function timeQuanturm(hour) {
        let wenhou = '好~'
        if (hour < 6) {
          wenhou = "凌晨好~";
        } else if (hour < 9) {
          wenhou = "早上好~";
        } else if (hour < 12) {
          wenhou = "上午好~";
        } else if (hour < 14) {
          wenhou = "中午好~";
        } else if (hour < 17) {
          wenhou = "下午好~";
        } else if (hour < 19) {
          wenhou = "傍晚好~";
        } else if (hour < 22) {
          wenhou = "晚上好~";
        } else {
          wenhou = "夜里好~";
        }
        return wenhou;
      };
      // 当前时间
      function NewTick(newDay) {
        let noww = newDay || new Date();
        return {
          noww: noww,
          nyear: noww.getFullYear(),
          nmonth: noww.getMonth() + 1,
          nwday: noww.getDay(),
          nday: noww.getDate(),
          nhrs: noww.getHours(),
          nmin: noww.getMinutes(),
          nsec: noww.getSeconds(),
        }
      };


      /* 
      // 计算时间差
      * @parames arr 节假日数组项
      * @parames day_gongli 当前时间对象
      */
      function getTimeDifference(arr, day_gongli = {}) {
        //开始时间 date1 //结束时间 date2
        let date1 = 0;
        let date2 = day_gongli['noww'].getTime();

        if (arr.length > 2) {
          let arr_gonli = TransitionLunar.toSolar(day_gongli.nyear,
            arr[0], arr[1]); // 当年的农历转公历对象数组
          let _sub = (new Date(`${arr_gonli[0]} ${arr_gonli[1]} ${arr_gonli[2]}`)) - date2
          if (_sub < 0) {
            arr_gonli = TransitionLunar.toSolar(day_gongli.nyear + 1,
              arr[0], arr[1]); // 明年的农历转公历对象数组
          }
          date1 = new Date(`${arr_gonli[0]} ${arr_gonli[1]} ${arr_gonli[2]} 00:00:00`).getTime();
        } else {
          date1 =
            new Date(
              `${arr[0] > day_gongli.nmonth ? day_gongli.nyear : (day_gongli.nyear + 1)} ${arr[0]} ${arr[1]} 00:00:00`
            ).getTime();
        }

        // console.log('date1:', date1)
        // console.log('date2:', date2)
        let date3 = date1 - date2; //时间差的毫秒数
        // console.log('date3:', date3)

        //------------------------------
        //计算出相差天数
        let days = Math.floor(date3 / (24 * 3600 * 1000))
        return days
        /* 
          //计算出小时数
          let leave1 = date3 % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
          let hours = Math.floor(leave1 / (3600 * 1000))
          //计算相差分钟数
          let leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数
          let minutes = Math.floor(leave2 / (60 * 1000))
          //计算相差秒数
          let leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
          let seconds = Math.round(leave3 / 1000)
          // return (days + "天 " + hours + "小时 " + minutes + " 分钟")
        */
      };


      // 绘制
      function Draw() {
        let day_gongli = NewTick(); // 公历
        let day_nongli = TransitionLunar.toLunar(day_gongli.nyear, day_gongli.nmonth, day_gongli.nday); // 农历
        // console.log(day_gongli)
        // console.log(day_nongli)
        //需要展示在页面地方
        let dom = document.getElementById('contentText');
        let tant1 = dom.querySelector('.tant1');
        let tant2 = dom.querySelector('.tant2');
        let tant3 = dom.querySelector('.tant3');
        let strHtml1 = `<div>
            【摸鱼办】提醒您：今天是 
            ${day_gongli.nyear}年${day_gongli.nmonth}月${day_gongli.nday}日，
            星期${hzWeek[day_gongli.nwday]}，
            农历${day_nongli[3]}[${day_nongli[4]}]年${day_nongli[5]}${day_nongli[6]}，
            大家${timeQuanturm(day_gongli.nhrs)}。工作再累，一定不要忘记休息哦！经常起身去茶水间，去厕所，去廊道走走别老在工位上坐着，钱是老板的,但命是自己的,祝愿天下所有打工人，都能愉快的度过每一天…
            </div>
            `;
        tant1.innerHTML = strHtml1;

        function draw2() {
          let strHtml2 = `
            <br/>
            当前时间：${formatDate_timestamp(new Date(),'yyyy-MM-dd HH:mm:ss')}
            `;
          tant2.innerHTML = strHtml2;
          requestAnimationFrame(draw2)
        }
        draw2();

        function draw3() {
          /* 节假日   params： 月，日，是否农历 */
          const festival = {
            '元旦': [1, 1],
            '新年': [1, 1, 1],
            '清明': [4, 5],
            '五一': [5, 1],
            '端午': [5, 5, 1],
            '中秋': [8, 15, 1],
            '国庆': [10, 1],
          };
          const remaining_days = [{
              name: '元旦',
              value: getTimeDifference(festival['元旦'], day_gongli)
            },
            {
              name: '新年',
              value: getTimeDifference(festival['新年'], day_gongli)
            },
            {
              name: '清明',
              value: getTimeDifference(festival['清明'], day_gongli)
            },
            {
              name: '五一',
              value: getTimeDifference(festival['五一'], day_gongli)
            },
            {
              name: '端午',
              value: getTimeDifference(festival['端午'], day_gongli)
            },
            {
              name: '中秋',
              value: getTimeDifference(festival['中秋'], day_gongli)
            },
            {
              name: '国庆',
              value: getTimeDifference(festival['国庆'], day_gongli)
            },
          ];
          const remaining_days_sort = remaining_days.sort(function compareNumbers(a, b) {
            return (a.value - b.value);
          })
          // console.log(remaining_days_sort)
          let strHtml3 = `
              距离【发工资】还有 ${(day_gongli.nday<28)?(28-day_gongli.nday):(new Date(day_gongli.nyear,day_gongli.nmonth,0).getDate()-day_gongli.nday+28)} 天
              <br/>
              距离【周末】还有 ${(0<day_gongli.nwday&&day_gongli.nwday<6)?6-day_gongli.nwday:day_gongli.nwday} 天
              `;
          remaining_days_sort.forEach(v => {
            strHtml3 += `
              <br/>
              距离【${v.name}】还有 ${v.value} 天
                `
          })
          tant3.innerHTML = strHtml3;
        }
        draw3();
      };
      Draw();

      /*  */
      /* // 火车点击事件 */
      const dom_huochetou = document.getElementsByClassName("center-train")[0].querySelector('.engine-front');
      const dom_tiegui = document.getElementsByClassName("center-train")[0].querySelector('.bridge');
      dom_huochetou.addEventListener('click', function () {
        // console.log('跳转')
        window.location.href = 'https://cxy521.com/'
      })
      /* 铁轨点击事件 */
      function copywxtap(text) {
        let textarea = document.createElement('textarea'); // 直接构建input
        textarea.value = text; // 设置内容
        // console.log(textarea.value);
        document.body.appendChild(textarea); // 添加临时实例
        textarea.select(); // 选择实例内容
        document.execCommand('Copy'); // 执行复制
        document.body.removeChild(textarea); // 删除临时实例
        alert('已复制文字')
      }
      dom_tiegui.addEventListener('click', function () {
        copywxtap(document.getElementById('contentText').innerText)
      })
    })(window);
  </script>
</body>

</html>